import { Integer, Entity, Title, Desc, Money, Boolean, DateTime, Discount, CouponType, CouponUseTo, CreateUserId, PrimaryUuid, CreateDate, UpdateDate, Tags, CouponCanUseTo } from '@sker/core'
@Entity({ name: 'coupon' })
export class Coupon {
    static title: string = `卡券`;
    static resource: string = `wx_coupon`;

    @PrimaryUuid({
        primaryKeyConstraintName: 'PK_WX_COUPON_ID'
    })
    id!: string;

    @Title({ comment: '优惠券名称' })
    title!: string;

    @Desc({ comment: '简介' })
    desc!: string;

    @CouponType({ comment: '优惠券类型：FULL_REDUCTION=满减， DISCOUNT=折扣' })
    type!: number;

    @Discount({ comment: '优惠金额或折扣率' })
    discount!: number;

    @Integer({ comment: '发放总量，0 表示不限制' })
    total!: number;

    @Integer({ comment: '剩余数量' })
    surplus!: number;

    @Money({ comment: '使用条件，满多少元可用' })
    condition!: number;

    @DateTime({comment: '有效期开始时间'})
    time_start!: Date;

    @DateTime({comment: '有效期结束时间'})
    time_end!: Date;

    @Boolean({ comment: '状态：false 禁用，true 启用' })
    status!: boolean;

    @CouponCanUseTo({ comment: '可使用场景', nullable: true, default: '' })
    can_use: string;

    @Tags({
        comment: '标签',
        default: []
    })
    tags!: string[]

    @CreateUserId({ type: 'uuid', comment: '创建人', nullable: true })
    create_uid!: string;

    @CreateDate({
        comment: '创建日期'
    })
    create_date!: Date;

    @UpdateDate({
        comment: '更新日期'
    })
    update_date!: Date;
}